﻿<%@ Page Title="myplandmaterialinfo" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="lcs.Web.myplandmaterialinfo.List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script language="javascript" src="/js/CheckBox.js" type="text/javascript"></script>
     <script src="../../js/myjs.js"></script>
     <link href="../../jquery-ui.min.css" rel="stylesheet" />   
    <script src="../../js/jquery-ui.min.js"></script>
     <script type="text/javascript">
         $(function () {
             $("#<%# txtKeyword.ClientID%>").autocomplete({
                 minLength: 2, // 设置搜索的关键字最小长度// 设置自动完成列表的函数，函数包括两个参数，requset和response      
                 source: function (request, response) {
                     $.ajax({
                         type: "POST",          // 通过request.term可以获得文本框内容   
                         url: "../../HandlerML.ashx?keyword=" + request.term,
                         contentType: "application/json; charset=gb2312",
                         dataType: "json",
                         success: function (data) {
                             // jQuery.map(array, callback) :将一个数组中的元素转换到另一个数组中。
                             //  下面就是把数组["value1", "value2",...]转换为[{value:"value1"}, {value:"value2"},...]                 
                             response($.map(data, function (item) {
                                 return { label: item.mlname + ":" + item.mlid, value: item.mlname + ":" + item.mlid };
                             }));
                         },
                         error: function () {
                             alert("ajax请求失败");
                         }
                     });
                 }
             });
         });
         </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<!--Title -->

            <!--Title end -->

            <!--Add  -->

            <!--Add end -->

            <!--Search -->
            <table style="width: 100%;" cellpadding="2" cellspacing="1" class="border">
                <tr>
                    <td style="width: 80px" align="right" class="tdbg">
                         <b>物料名：</b>
                    </td>
                    <td class="tdbg">                       
                    <asp:TextBox ID="txtKeyword" runat="server"></asp:TextBox>
                    &nbsp;<b>数量：</b>&nbsp;<asp:TextBox ID="txtnum" runat="server"></asp:TextBox>&nbsp;
                    <asp:Button ID="btnSearch" runat="server" Text="联动增加"  OnClick="btnSearch_Click" >
                    </asp:Button>                    
                        
                    </td>
                    <td class="tdbg">
                        <asp:HyperLink ID="hladd" runat="server">增加</asp:HyperLink>
                    </td>
                </tr>
            </table>
            <!--Search end-->
            <br />
            <asp:GridView ID="gridView" runat="server" AllowPaging="True" Width="100%" BorderWidth="0px" CellPadding="0" CellSpacing="1" CssClass="gv" GridLines="None"   OnPageIndexChanging ="gridView_PageIndexChanging"
                    DataKeyNames="mpmid" OnRowDataBound="gridView_RowDataBound"
                    AutoGenerateColumns="false" PageSize="10"  RowStyle-HorizontalAlign="Center" OnRowCreated="gridView_OnRowCreated">
                    <Columns>
                    <asp:TemplateField ControlStyle-Width="30" HeaderText="选择"    >
                               <HeaderTemplate>
                                    <input id="Checkbox1" type="checkbox" onclick="chall(this)" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="DeleteThis" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField> 
                            
		<%--<asp:BoundField DataField="mpid" HeaderText="mpid" SortExpression="mpid" ItemStyle-HorizontalAlign="Center"  /> --%>
		<asp:BoundField DataField="mname" HeaderText="物料描述" SortExpression="mname" ItemStyle-HorizontalAlign="Center"  /> 
		<asp:BoundField DataField="mnum" HeaderText="数量" SortExpression="mnum" ItemStyle-HorizontalAlign="Center"  DataFormatString="{0:0.00}" />                             
                            
                            <asp:HyperLinkField HeaderText="编辑" ControlStyle-Width="50" DataNavigateUrlFields="mpmid" DataNavigateUrlFormatString="Modify.aspx?id={0}"
                                Text="编辑"  />
                            
                        </Columns>
                </asp:GridView>
               <table border="0" cellpadding="0" cellspacing="1" style="width: 100%;">
                <tr>
                    <td style="width: 1px;">                        
                    </td>
                    <td align="left">
                        <asp:Button ID="btnDelete" runat="server" Text="删除" OnClick="btnDelete_Click"/>  
                        <asp:Button ID="btn_out" runat="server" Text="导出" OnClick="btn_out_Click" />                     
                    </td>
                </tr>
            </table>
</asp:Content>
<%--<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceCheckright" runat="server">
</asp:Content>--%>
